package com.example.hanfu_bk.controller;

import com.example.hanfu_bk.pojo.Hanfu;
import com.example.hanfu_bk.pojo.Result;
import com.example.hanfu_bk.pojo.Swiper;
import com.example.hanfu_bk.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;
@CrossOrigin
@RestController
@RequestMapping ("/home")
public class HomeController {
    @Autowired
    private HomeService homeService;

    @GetMapping("/swiper")
    public Result swiper() {
        return Result.success(homeService.getActiveSwipers());
    }
    @GetMapping("/storyBox")
    public Result storyBox() {
        return Result.success(homeService.getActiveStoryBoxes());
    }
    @GetMapping("/dynasty/{id}")
    public Result dynasty(@PathVariable int id) {
        return Result.success(homeService.getDynastyById(id));
    }
    @GetMapping("/getStoryContent/{id}")
    public Result getStoryContent(@PathVariable int id) {
        return Result.success(homeService.getContentById(id));
    }
}
